package jmine.tec.web.front.services.incluir;

import jmine.tec.services.annotations.Input;
import jmine.tec.services.annotations.ServiceImplementor;
import jmine.tec.services.api.ActionsEnum;
import jmine.tec.services.api.export.ReferenceMap;
import jmine.tec.services.export.impl.ExportUtils;
import jmine.tec.services.io.ServiceBean;
import jmine.tec.web.front.domain.BackOfficeRequestPropertyBigDecimal;

/**
 * Service for creating {@link BackOfficeRequestPropertyBigDecimal}
 * 
 * @author vinicius
 */
@ServiceImplementor(action = ActionsEnum.INCLUIR)
public class BackOfficeRequestPropertyBigDecimalService extends
        AbstractBackOfficeRequestPropertyService<BackOfficeRequestPropertyBigDecimal> {

    public static final String DECIMALS = "Decimals";

    private Integer decimals;

    /**
     * {@inheritDoc}
     */
    @Override
    protected Class<BackOfficeRequestPropertyBigDecimal> getPropertyClass() {
        return BackOfficeRequestPropertyBigDecimal.class;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void fillSpecific(BackOfficeRequestPropertyBigDecimal property) {
        super.fillSpecific(property);
        property.setDecimals(this.decimals);
    }

    /**
     * @param decimals the decimals to set
     */
    @Input(fieldName = DECIMALS, required = true)
    public void setDecimals(Integer decimals) {
        this.decimals = decimals;
    }

    /**
     * {@inheritDoc}
     */
    public void fillServiceBean(ServiceBean bean, ReferenceMap referenceMap, BackOfficeRequestPropertyBigDecimal entity) {
        super.fillServiceBean(bean, referenceMap, entity);
        ExportUtils.put(bean, DECIMALS, entity.getDecimals());
    }

}
